﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Admin/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage<BlogPlat.Model.Post>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Editing Post - BlogPlat.NET - .NET Blogging Platform
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
    <%= Html.Telerik().StyleSheetRegistrar()
        .DefaultGroup(group => group.Add("telerik.common.css")
                                    .Add("telerik.vista.css"))
    %>
    <script language="javascript" type="text/javascript">
        $(document).ready(function () {
            $("#PostTitle").focusout(function () {
                $("#FriendlyUrl").val($("#PostTitle").val().split(' ').join('-'));
            });

            $("#cbxFriendlyUrl").click(function () {
                if (this.checked) {
                    $("#FriendlyUrl").val("");
                }
                else {
                    $("#FriendlyUrl").val($("#PostTitle").val().split(' ').join('-'));
                }
            });
        });
    </script>
    <script type="text/javascript" src="/areas/admin/scripts/ckeditor/ckeditor.js"></script>
    <script type="text/javascript">
        window.onload = function () {
            CKEDITOR.replace('PostContent',
            {
                toolbar:
                [
                    ['Source', '-'],
                    ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-'],
                    ['Undo', 'Redo', '-', 'Find', 'Replace', '-', 'SelectAll', 'RemoveFormat'],
                    ['Link', 'Unlink', 'Anchor'],
                    ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote'],
                    ['TextColor', 'BGColor'],
                    ['Maximize', 'ShowBlocks', '-'],
                    '/',
                    ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript'],
                    ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
                    ['Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak'],
                    ['Styles', 'Format', 'Font', 'FontSize'],
                ],
                filebrowserImageBrowseUrl: '/admin/upload',
                height: 350,
                ignoreEmptyParagraph: true,
                htmlEncodeOutput: true
            });
        };
    </script>    
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Editing Post: <%: Model.PostTitle %></h2>

    <% using (Html.BeginForm()) {%>
        <%: Html.ValidationSummary(true) %>
              
              <table cellspacing="1" width="1000">
                <tr>
                    <th class="alignleft" colspan="3">
                        <%: Html.ActionLink("Back to List", "index") %>
                    </th>
                </tr>
                <tr class="even">
                    <td width="200"><b><%: Html.LabelFor(model => model.Author) %></b></td>
                    <td width="100"><b><%: Html.LabelFor(model => model.IsDraft) %></b></td>
                    <td><b><%: Html.LabelFor(model => model.EnableComments) %></b></td>
                </tr>
                <tr>                    
                    <td width="200"><% Html.RenderAction("CurrentUser"); %><%: Html.HiddenFor(model => model.Author) %></td> 
                    <td width="100"><%: Html.CheckBoxFor(model => model.IsDraft) %></td>
                    <td><%: Html.CheckBoxFor(model => model.EnableComments) %></td>                   
                </tr>
                <tr class="even">
                    <td align="left" colspan="3"><b><%: Html.LabelFor(model => model.PostTitle) %></b></td>
                </tr>
                <tr>
                    <td align="left" colspan="3">
                        <%: Html.TextBoxFor(model => model.PostTitle, new { @class = "textbox" })%>
                        <%: Html.ValidationMessageFor(model => model.PostTitle) %>
                    </td>
                </tr>
                <tr class="even">
                    <td align="left" colspan="3"><b><%: Html.LabelFor(model => model.FriendlyUrl) %></b></td>
                </tr>
                <tr>
                    <td align="left" colspan="3">
                        <%: Html.TextBoxFor(model => model.FriendlyUrl, new { @class = "textbox" })%>
                        <%: Html.ValidationMessageFor(model => model.FriendlyUrl) %>
                        <input type="checkbox" id="cbxFriendlyUrl" name="cbxFriendlyUrl" /> Let me specify my own friendly url
                    </td>
                </tr>
                <tr class="even">
                    <td align="left" colspan="3"><b><%: Html.LabelFor(model => model.DatePublished) %></b></td>
                </tr>
                <tr>
                    <td align="left" colspan="3">
                        <%: Html.EditorFor(model => model.DatePublished, "DateTime", new { publishdate = Model.DatePublished })%>
                        <%: Html.ValidationMessageFor(model => model.DatePublished) %>
                    </td>
                </tr>
                <tr class="even">
                    <td align="left" colspan="3"><b><%: Html.LabelFor(model => model.PostSummary) %></b></td>
                </tr>
                <tr>
                    <td align="left" colspan="3">
                        <%: Html.TextBoxFor(model => model.PostSummary, new { @class = "textbox" })%>
                        <%: Html.ValidationMessageFor(model => model.PostSummary) %>
                    </td>
                </tr>
                <tr class="even">
                    <td align="left" colspan="3"><b><%: Html.LabelFor(model => model.PostContent) %></b></td>
                </tr>
                <tr>
                    <td align="left" colspan="3">   
                        <%: Html.TextAreaFor(model => model.PostContent) %>                     
                        <%--<%: Html.EditorFor(model => Model.PostContent, "HtmlEditor", new { content = Model.PostContent }) %>--%>
                        <%: Html.ValidationMessageFor(model => model.PostContent) %>
                    </td>
                </tr>                
                <tr>
                    <td align="left">
                        <input type="submit" value="Save" />
                    </td>
                </tr>                
              </table>                                      
    <% } %>
</asp:Content>